<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
   
   <meta name="description" content="string operations">
    
    <meta name="author" content="John S. Urban" >
    <link rel="icon" href="../favicon.png">

    <title>modif &ndash; M_strings</title>

    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/pygments.css" rel="stylesheet">
    <link href="../css/font-awesome.min.css" rel="stylesheet">
    <link href="../css/local.css" rel="stylesheet">
    
    <link  href="../tipuesearch/tipuesearch.css" rel="stylesheet">
    
    

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    
    <script src="../js/jquery-2.1.3.min.js"></script>
    <script src="../js/svg-pan-zoom.min.js"></script>

  </head>

  <body>

    <!-- Fixed navbar -->
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="../index.html">M_strings </a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
        
            <li class="dropdown hidden-xs visible-sm visible-md hidden-lg">
              <a href="#" class="dropdown-toggle"
              data-toggle="dropdown" role="button"
              aria-haspopup="true"
     aria-expanded="false">Contents <span class="caret"></span></a>
        <ul class="dropdown-menu">
          
              
            <li><a href="../lists/files.html">Source Files</a></li>
        
        
        
            <li><a href="../lists/modules.html">Modules</a></li>
        
            
                                
            <li><a href="../lists/procedures.html">Procedures</a></li>
        
               
            <li><a href="../lists/types.html">Derived Types</a></li>
        
        
            </ul>
            </li>


<li class="visible-xs hidden-sm visible-lg"><a href="../lists/files.html">Source Files</a></li>



<li class="visible-xs hidden-sm visible-lg"><a href="../lists/modules.html">Modules</a></li>



<li class="visible-xs hidden-sm visible-lg"><a href="../lists/procedures.html">Procedures</a></li>

                             
<li class="visible-xs hidden-sm visible-lg"><a href="../lists/types.html">Derived Types</a></li>


          </ul>
        
        <form action="../search.html" class="navbar-form navbar-right" role="search">
        <div class="form-group">
          <input type="text" class="form-control" placeholder="Search" name="q" id="tipue_search_input" autocomplete="off" required>
        </div>
<!--
        <button type="submit" class="btn btn-default">Submit</button>
-->
        </form>
        
        </div><!--/.nav-collapse -->
      </div>
    </nav>

    <div class="container">
    
  
  <div class="row">
    <h1>modif
      <small>Subroutine</small>
    
    </h1>
    
<div class="row">
  <div class="col-lg-12">
<div class="well well-sm">
  <ul class="list-inline" style="margin-bottom:0px;display:inline">
     
     
     
     
    
    
     <li><i class="fa fa-list-ol"></i>
       <a data-toggle="tooltip"
    data-placement="bottom" data-html="true"
    title=" 2.6% of total for procedures.">63 statements</a>
     </li> 
     
     
     
    <li><i class="fa fa-code"></i><a href="../src/M_strings.f90"> Source File</a></li>
     
     
  </ul>
  <ol class="breadcrumb in-well text-right">
  
    
     <li><a href='../sourcefile/m_strings.f90.html'>M_strings.f90</a></li>
    
     <li><a href='../module/m_strings.html'>M_strings</a></li>
    
  
     <li class="active">modif</li>
  </ol>
</div>
</div>
</div>
<script>
  $(function () {
  $('[data-toggle="tooltip"]').tooltip()
  })
</script>

  </div>
  
  <div class="row">
    <div class="col-md-3 hidden-xs hidden-sm visible-md visible-lg">
    
<div id="sidebar">
  
<h3>Contents</h3>
 



<div class="panel panel-primary">
  <div class="panel-heading text-left"><h3 class="panel-title"><a data-toggle="collapse" href="#vars-0">Variables</a></h3></div>
  <div id="vars-0" class="panel-collapse collapse">
    <div class="list-group">
      
      <a class="list-group-item" href="../proc/modif.html#variable-c~2">c</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-cmod">cmod</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-dum2">dum2</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-i~23">i</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-ic~3">ic</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-ichr~2">ichr</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-iend~6">iend</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-j~2">j</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-linsrt">linsrt</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-lmax~2">lmax</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-lmx1">lmx1</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-maxscra">maxscra</a>
      
    </div>
  </div>
</div>




















<div class="panel panel-primary">
  <div class="panel-heading text-left"><h3 class="panel-title">Source Code</h3></div>
  <div class="list-group">
    <a class="list-group-item" href="../proc/modif.html#src">modif</a>
  </div>
</div>



</div>

    </div>
    
    <div class="col-md-9" id='text'>
    <h2>
public subroutine modif(cline, mod)
    
    
   
</h2>
    
  


    
    <h2 id="name">NAME</h2>
<div class="codehilite"><pre><span></span><code>modif(3f) - [M_strings:EDITING] emulate the MODIFY command from the
line editor XEDIT
(LICENSE:PD)
</code></pre></div>

<h2 id="synopsis">SYNOPSIS</h2>
<div class="codehilite"><pre><span></span><code>subroutine modif(cline,cmod)

 character(len=*) :: cline ! input string to change
 ! directive provides directions on changing string
 character(len=*) :: cmod
</code></pre></div>

<h2 id="description">DESCRIPTION</h2>
<p>MODIF(3f) Modifies the line currently pointed at using a directive
   that acts much like a line editor directive.
   Primarily used to create interactive utilities such as input history
   editors for interactive line-mode programs.</p>
<p>the modify directives are as follows-</p>
<div class="codehilite"><pre><span></span><code><span class="n">DIRECTIVE</span> <span class="n">EXPLANATION</span>

<span class="o">^</span><span class="n">STRING</span><span class="p">#</span>   <span class="n">Causes</span> <span class="n">the</span> <span class="k">string</span> <span class="n">of</span> <span class="n">characters</span> <span class="n">between</span> <span class="n">the</span> <span class="o">^</span> <span class="k">and</span> <span class="n">the</span>
           <span class="n">next</span> <span class="p">#</span> <span class="n">to</span> <span class="n">be</span> <span class="n">inserted</span> <span class="n">before</span> <span class="n">the</span> <span class="n">characters</span> <span class="n">pointed</span> <span class="n">to</span>
           <span class="n">by</span> <span class="n">the</span> <span class="o">^</span><span class="p">.</span> <span class="n">an</span> <span class="o">^</span> <span class="k">or</span> <span class="o">&amp;</span> <span class="n">within</span> <span class="n">the</span> <span class="k">string</span> <span class="n">is</span> <span class="n">treated</span> <span class="n">as</span> <span class="n">a</span>
           <span class="n">regular</span> <span class="n">character</span><span class="p">.</span> <span class="n">If</span> <span class="n">the</span> <span class="n">closing</span> <span class="p">#</span> <span class="n">is</span> <span class="k">not</span> <span class="n">specified</span><span class="p">,</span>
           <span class="n">MODIF</span><span class="p">(</span><span class="mf">3f</span><span class="p">)</span> <span class="n">inserts</span> <span class="n">the</span> <span class="n">remainder</span> <span class="n">of</span> <span class="n">the</span> <span class="n">line</span> <span class="n">as</span> <span class="k">if</span> <span class="n">a</span> <span class="p">#</span> <span class="n">was</span>
           <span class="n">specified</span> <span class="n">after</span> <span class="n">the</span> <span class="n">last</span> <span class="n">nonblank</span> <span class="n">character</span><span class="p">.</span>

           <span class="n">There</span> <span class="n">are</span> <span class="n">two</span> <span class="n">exceptions</span><span class="p">.</span> <span class="n">the</span> <span class="n">combination</span> <span class="o">^</span><span class="p">#</span> <span class="n">causes</span> <span class="n">a</span> <span class="p">#</span>
           <span class="n">to</span> <span class="n">be</span> <span class="n">inserted</span> <span class="n">before</span> <span class="n">the</span> <span class="n">character</span> <span class="n">pointed</span> <span class="n">to</span> <span class="n">by</span> <span class="n">the</span>
           <span class="o">^</span><span class="p">,</span> <span class="k">and</span> <span class="n">an</span> <span class="o">^</span> <span class="n">as</span> <span class="n">the</span> <span class="n">last</span> <span class="n">character</span> <span class="n">of</span> <span class="n">the</span> <span class="n">directives</span>
           <span class="n">causes</span> <span class="n">a</span> <span class="n">blank</span> <span class="n">to</span> <span class="n">be</span> <span class="n">inserted</span><span class="p">.</span>

<span class="p">#</span>          <span class="p">(</span><span class="n">When</span> <span class="k">not</span> <span class="n">the</span> <span class="n">first</span> <span class="p">#</span> <span class="n">after</span> <span class="n">an</span> <span class="o">^</span><span class="p">)</span> <span class="n">causes</span> <span class="n">the</span> <span class="n">character</span>
           <span class="n">above</span> <span class="n">it</span> <span class="n">to</span> <span class="n">be</span> <span class="n">deleted</span><span class="p">.</span>

<span class="o">&amp;</span>          <span class="n">Replaces</span> <span class="n">the</span> <span class="n">character</span> <span class="n">above</span> <span class="n">it</span> <span class="n">with</span> <span class="n">a</span> <span class="n">space</span><span class="p">.</span>

<span class="p">(</span><span class="n">SPACE</span><span class="p">)</span>    <span class="n">A</span> <span class="n">space</span> <span class="n">below</span> <span class="n">a</span> <span class="n">character</span> <span class="n">leaves</span> <span class="n">it</span> <span class="n">unchanged</span><span class="p">.</span>

<span class="n">Any</span> <span class="n">other</span> <span class="n">character</span> <span class="n">replaces</span> <span class="n">the</span> <span class="n">character</span> <span class="n">above</span> <span class="n">it</span><span class="p">.</span>
</code></pre></div>

<h2 id="examples">EXAMPLES</h2>
<p>Example input/output:</p>
<div class="codehilite"><pre><span></span><code>THE INPUT LINE........ 10 THIS STRING  TO BE MORTIFD
THE DIRECTIVES LINE...        ^ IS THE#        D#  ^IE
ALTERED INPUT LINE.... 10 THIS IS THE STRING  TO BE MODIFIED
</code></pre></div>

<p>Sample program:</p>
<div class="codehilite"><pre><span></span><code><span class="nv">program</span> <span class="nv">demo_modif</span>
<span class="nv">use</span> <span class="nv">M_strings</span>, <span class="nv">only</span> : <span class="nv">modif</span>
<span class="nv">implicit</span> <span class="nv">none</span>
<span class="nv">character</span><span class="ss">(</span><span class="nv">len</span><span class="o">=</span><span class="mi">256</span><span class="ss">)</span>           :: <span class="nv">line</span>
<span class="nv">integer</span>                      :: <span class="nv">ios</span>
<span class="nv">integer</span>                      :: <span class="nv">count</span>
<span class="nv">integer</span>                      :: <span class="nv">COMMAND_LINE_LENGTH</span>
<span class="nv">character</span><span class="ss">(</span><span class="nv">len</span><span class="o">=</span>:<span class="ss">)</span>,<span class="nv">allocatable</span> :: <span class="nv">COMMAND_LINE</span>
   <span class="o">!</span> <span class="nv">get</span> <span class="nv">command</span> <span class="nv">name</span> <span class="nv">length</span>
   <span class="k">call</span> <span class="nl">get_command_argument</span><span class="ss">(</span><span class="mi">0</span>,<span class="nv">length</span><span class="o">=</span><span class="nv">count</span><span class="ss">)</span>
   <span class="o">!</span> <span class="nv">get</span> <span class="nv">command</span> <span class="nv">line</span> <span class="nv">length</span>
   <span class="k">call</span> <span class="nl">get_command</span><span class="ss">(</span><span class="nv">length</span><span class="o">=</span><span class="nv">COMMAND_LINE_LENGTH</span><span class="ss">)</span>
   <span class="o">!</span> <span class="nv">allocate</span> <span class="nv">string</span> <span class="nv">big</span> <span class="nv">enough</span> <span class="nv">to</span> <span class="nv">hold</span> <span class="nv">command</span> <span class="nv">line</span>
   <span class="nv">allocate</span><span class="ss">(</span><span class="nv">character</span><span class="ss">(</span><span class="nv">len</span><span class="o">=</span><span class="nv">COMMAND_LINE_LENGTH</span><span class="o">+</span><span class="mi">200</span><span class="ss">)</span> :: <span class="nv">COMMAND_LINE</span><span class="ss">)</span>
   <span class="o">!</span> <span class="nv">get</span> <span class="nv">command</span> <span class="nv">line</span> <span class="nv">as</span> <span class="nv">a</span> <span class="nv">string</span>
   <span class="k">call</span> <span class="nl">get_command</span><span class="ss">(</span><span class="nv">command</span><span class="o">=</span><span class="nv">COMMAND_LINE</span><span class="ss">)</span>
   <span class="o">!</span> <span class="nv">trim</span> <span class="nv">leading</span> <span class="nv">spaces</span> <span class="nv">just</span> <span class="nv">in</span> <span class="nv">case</span>
   <span class="nv">COMMAND_LINE</span><span class="o">=</span><span class="nv">adjustl</span><span class="ss">(</span><span class="nv">COMMAND_LINE</span><span class="ss">)</span>
   <span class="o">!</span> <span class="nv">remove</span> <span class="nv">command</span> <span class="nv">name</span>
   <span class="nv">COMMAND_LINE</span><span class="o">=</span><span class="nv">adjustl</span><span class="ss">(</span><span class="nv">COMMAND_LINE</span><span class="ss">(</span><span class="nv">COUNT</span><span class="o">+</span><span class="mi">2</span>:<span class="ss">))</span>
   <span class="nv">INFINITE</span>: <span class="k">do</span>
      <span class="nv">read</span><span class="ss">(</span><span class="o">*</span>,<span class="s1">&#39;</span><span class="s">(a)</span><span class="s1">&#39;</span>,<span class="nv">iostat</span><span class="o">=</span><span class="nv">ios</span><span class="ss">)</span><span class="nv">line</span>
      <span class="k">if</span><span class="ss">(</span><span class="nv">ios</span>.<span class="nv">ne</span>.<span class="mi">0</span><span class="ss">)</span><span class="k">exit</span>
      <span class="k">call</span> <span class="nl">modif</span><span class="ss">(</span><span class="nv">line</span>,<span class="nv">COMMAND_LINE</span><span class="ss">)</span>
      <span class="nv">write</span><span class="ss">(</span><span class="o">*</span>,<span class="s1">&#39;</span><span class="s">(a)</span><span class="s1">&#39;</span><span class="ss">)</span><span class="nv">trim</span><span class="ss">(</span><span class="nv">line</span><span class="ss">)</span>
   <span class="nv">enddo</span> <span class="nv">INFINITE</span>
<span class="k">end</span> <span class="nv">program</span> <span class="nv">demo_modif</span>
</code></pre></div>

<h2 id="author">AUTHOR</h2>
<div class="codehilite"><pre><span></span><code>John S. Urban
</code></pre></div>

<h2 id="license">LICENSE</h2>
<div class="codehilite"><pre><span></span><code>Public Domain
</code></pre></div>
    

    <h3>Arguments</h3>
    
      
<table class="table table-striped varlist">
<thead><tr><th>Type</th>
<th>Intent</th><th>Optional</th>
<th>Attributes</th><th></th><th>Name</th><th></th></thead>



<tbody>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-cline"></span>character(len=*)</td>
  <td></td>
  <td></td>
  
  <td></td><td>::</td>
  <td><strong>cline</strong></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-mod"></span>character(len=*),</td>
  <td>intent(in)</td>
  <td></td>
  
  <td></td><td>::</td>
  <td><strong>mod</strong></td><td></td>
  
</tr>

</tbody>
</table>

    
    
    
    
     
    <br>

    <section class="visible-xs visible-sm hidden-md">
      
<h3>Contents</h3>
 



<div class="panel panel-primary">
  <div class="panel-heading text-left"><h3 class="panel-title"><a data-toggle="collapse" href="#vars-1">Variables</a></h3></div>
  <div id="vars-1" class="panel-collapse collapse">
    <div class="list-group">
      
      <a class="list-group-item" href="../proc/modif.html#variable-c~2">c</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-cmod">cmod</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-dum2">dum2</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-i~23">i</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-ic~3">ic</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-ichr~2">ichr</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-iend~6">iend</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-j~2">j</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-linsrt">linsrt</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-lmax~2">lmax</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-lmx1">lmx1</a>
      
      <a class="list-group-item" href="../proc/modif.html#variable-maxscra">maxscra</a>
      
    </div>
  </div>
</div>




















<div class="panel panel-primary">
  <div class="panel-heading text-left"><h3 class="panel-title">Source Code</h3></div>
  <div class="list-group">
    <a class="list-group-item" href="../proc/modif.html#src">modif</a>
  </div>
</div>



    </section>
    <br class="visible-xs visible-sm hidden-md">

    

    
    <section>    
      <h2>Variables</h2>
    
<table class="table table-striped varlist">
<thead><tr><th>Type</th><th>Visibility</th>

<th>Attributes</th><th></th><th>Name</th><th></th><th>Initial</th><th></th></thead>



<tbody>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-c~2"></span>character(len=3),</td>
  
  <td>public,</td>
  <td>parameter</td><td>::</td>
  <td><strong>c</strong></td><td> =</td><td>'#&^'</td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-cmod"></span>character(len=len(cline)),</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>cmod</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-dum2"></span>character(len=len(cline)),</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>dum2</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-i~23"></span>integer,</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>i</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-ic~3"></span>integer,</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>ic</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-ichr~2"></span>integer,</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>ichr</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-iend~6"></span>integer,</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>iend</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-j~2"></span>integer,</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>j</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-linsrt"></span>logical,</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>linsrt</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-lmax~2"></span>integer,</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>lmax</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-lmx1"></span>integer,</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>lmx1</strong></td><td></td><td></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-maxscra"></span>integer,</td>
  
  <td>public</td>
  <td></td><td>::</td>
  <td><strong>maxscra</strong></td><td></td><td></td><td></td>
  
</tr>

</tbody>
</table>

    </section>
    <br>
    
    
    
    
    

    
    
    
    
    


    
    
    
    <section>
    <h2><span class="anchor" id="src"></span>Source Code</h2>
    <div class="highlight"><pre><span></span><span class="k">subroutine </span><span class="n">modif</span><span class="p">(</span><span class="n">cline</span><span class="p">,</span><span class="nb">mod</span><span class="p">)</span>

<span class="c">!$@(#) M_strings::modif(3f): Emulate the MODIFY command from the line editor XEDIT</span>

<span class="c">!</span>
<span class="c">! MODIF</span>
<span class="c">! =====</span>
<span class="c">! ACTION- MODIFIES THE LINE CURRENTLY POINTED AT. THE INPUT STRING CLINE IS ASSUMED TO BE LONG ENOUGH TO ACCOMMODATE THE CHANGES</span>
<span class="c">!         THE MODIFY DIRECTIVES ARE AS FOLLOWS-</span>
<span class="c">!</span>
<span class="c">!   DIRECTIVE                       EXPLANATION</span>
<span class="c">!   ---------                       ------------</span>
<span class="c">!   ^STRING#   CAUSES THE STRING OF CHARACTERS BETWEEN THE ^ AND THE</span>
<span class="c">!              NEXT  # TO BE INSERTED BEFORE THE CHARACTERS POINTED TO</span>
<span class="c">!              BY THE ^. AN ^ OR &amp; WITHIN THE STRING IS TREATED AS A</span>
<span class="c">!              REGULAR CHARACTER. IF THE CLOSING # IS NOT SPECIFIED,</span>
<span class="c">!              MODIF(3f) INSERTS THE REMAINDER OFTHELINE AS IF A # WAS</span>
<span class="c">!              SPECIFIED AFTER THE LAST NONBLANK CHARACTER.</span>
<span class="c">!</span>
<span class="c">!              THERE ARE TWO EXCEPTIONS. THE COMBINATION ^# CAUSES A #</span>
<span class="c">!              TO BE INSERTED BEFORE THE CHARACTER POINTED TO BY THE</span>
<span class="c">!              ^,  AND AN ^ AS THE LAST CHARACTER OF THE DIRECTIVES</span>
<span class="c">!              CAUSES A BLANK TO BE INSERTED.</span>
<span class="c">!</span>
<span class="c">!   #          (WHEN NOT THE FIRST # AFTER AN ^) CAUSES THE CHARACTER</span>
<span class="c">!              ABOVE IT TO BE DELETED.</span>
<span class="c">!</span>
<span class="c">!   &amp;          REPLACES THE CHARACTER ABOVE IT WITH A SPACE.</span>
<span class="c">!</span>
<span class="c">!   (SPACE)    A SPACE BELOW A CHARACTER LEAVES IT UNCHANGED.</span>
<span class="c">!</span>
<span class="c">!   ANY OTHER CHARACTER REPLACES THE CHARACTER ABOVE IT.</span>
<span class="c">!</span>
<span class="c">! EXAMPLE-</span>
<span class="c">! THE INPUT LINE........ 10 THIS STRING  TO BE MORTIFD</span>
<span class="c">! THE DIRECTIVES LINE...        ^ IS THE#        D#  ^IE</span>
<span class="c">! ALTERED INPUT LINE.... 10 THIS IS THE STRING  TO BE MODIFIED</span>
<span class="c">!CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</span>
<span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">)</span>            <span class="kd">::</span> <span class="n">cline</span>        <span class="c">!STRING TO BE MODIFIED</span>
<span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span> <span class="kd">::</span> <span class="nb">mod</span>          <span class="c">!STRING TO DIRECT MODIFICATION</span>
<span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">cline</span><span class="p">))</span>   <span class="kd">::</span> <span class="n">cmod</span>
<span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="mi">3</span><span class="p">),</span><span class="k">parameter</span>  <span class="kd">::</span> <span class="n">c</span><span class="o">=</span><span class="s1">&#39;#&amp;^&#39;</span>      <span class="c">!ASSIGN DEFAULT EDIT CHARACTERS</span>
<span class="kt">integer</span>                     <span class="kd">::</span> <span class="n">maxscra</span>      <span class="c">!LENGTH OF SCRATCH BUFFER</span>
<span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">cline</span><span class="p">))</span>   <span class="kd">::</span> <span class="n">dum2</span>         <span class="c">!SCRATCH CHARACTER BUFFER</span>
<span class="kt">logical</span>                     <span class="kd">::</span> <span class="n">linsrt</span>       <span class="c">!FLAG FOR INSERTING DATA ON LINE</span>
<span class="kt">integer</span> <span class="kd">::</span> <span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">ic</span><span class="p">,</span> <span class="n">ichr</span><span class="p">,</span> <span class="n">iend</span><span class="p">,</span> <span class="n">lmax</span><span class="p">,</span> <span class="n">lmx1</span>
<span class="n">maxscra</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">cline</span><span class="p">)</span>
   <span class="n">cmod</span><span class="o">=</span><span class="nb">trim</span><span class="p">(</span><span class="nb">mod</span><span class="p">)</span>
   <span class="n">lmax</span><span class="o">=</span><span class="n">min0</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">cline</span><span class="p">),</span><span class="n">maxscra</span><span class="p">)</span>         <span class="c">!DETERMINE MAXIMUM LINE LENGTH</span>
   <span class="n">lmx1</span><span class="o">=</span><span class="n">lmax</span><span class="o">-</span><span class="mi">1</span>                           <span class="c">!MAX LINE LENGTH -1</span>
   <span class="n">dum2</span><span class="o">=</span><span class="s1">&#39; &#39;</span>                              <span class="c">!INITIALIZE NEW LINE</span>
   <span class="n">linsrt</span><span class="o">=</span><span class="p">.</span><span class="n">false</span><span class="p">.</span>                        <span class="c">!INITIALIZE INSERT MODE</span>
   <span class="n">iend</span><span class="o">=</span><span class="nb">len_trim</span><span class="p">(</span><span class="n">cmod</span><span class="p">)</span>                   <span class="c">!DETERMINE END OF MODS</span>
   <span class="n">i</span><span class="o">=</span><span class="mi">0</span>                                   <span class="c">!CHAR COUNTER FOR MOD LINE CMOD</span>
   <span class="n">ic</span><span class="o">=</span><span class="mi">0</span>                                  <span class="c">!CHAR COUNTER FOR CURRENT LINE CLINE</span>
   <span class="n">ichr</span><span class="o">=</span><span class="mi">0</span>                                <span class="c">!CHAR COUNTER NEW LINE DUM2</span>
<span class="mi">11</span> <span class="k">continue</span>
<span class="k">   </span><span class="n">i</span><span class="o">=</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span>                                 <span class="c">!NEXT CHAR IN MOD LINE</span>
   <span class="k">if</span><span class="p">(</span><span class="n">ichr</span><span class="p">.</span><span class="n">gt</span><span class="p">.</span><span class="n">lmx1</span><span class="p">)</span><span class="k">goto </span><span class="mi">999</span>              <span class="c">!IF TOO MANY CHARS IN NEW LINE</span>
   <span class="k">if</span><span class="p">(</span><span class="n">linsrt</span><span class="p">)</span> <span class="k">then</span>                       <span class="c">!IF INSERTING NEW CHARS</span>
      <span class="k">if</span><span class="p">(</span><span class="n">i</span><span class="p">.</span><span class="n">gt</span><span class="p">.</span><span class="n">iend</span><span class="p">)</span> <span class="n">cmod</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">)</span><span class="o">=</span><span class="n">c</span><span class="p">(</span><span class="mi">1</span><span class="p">:</span><span class="mi">1</span><span class="p">)</span>     <span class="c">!FORCE END OF INSERT MODE</span>
      <span class="k">if</span><span class="p">(</span><span class="n">cmod</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">).</span><span class="n">eq</span><span class="p">.</span><span class="n">c</span><span class="p">(</span><span class="mi">1</span><span class="p">:</span><span class="mi">1</span><span class="p">))</span><span class="k">then</span>        <span class="c">!IF END OF INSERT MODE</span>
         <span class="n">linsrt</span><span class="o">=</span><span class="p">.</span><span class="n">false</span><span class="p">.</span>                  <span class="c">!RESET INSERT MODE FLAG</span>
         <span class="k">if</span><span class="p">(</span><span class="n">ic</span><span class="o">+</span><span class="mf">1.</span><span class="n">eq</span><span class="p">.</span><span class="n">i</span><span class="p">)</span><span class="k">then</span>               <span class="c">!NULL INSERT STRING</span>
            <span class="n">ichr</span><span class="o">=</span><span class="n">ichr</span><span class="o">+</span><span class="mi">1</span>                  <span class="c">!INCREMENT COUNTER FOR NEW LINE</span>
            <span class="n">dum2</span><span class="p">(</span><span class="n">ichr</span><span class="p">:</span><span class="n">ichr</span><span class="p">)</span><span class="o">=</span><span class="n">c</span><span class="p">(</span><span class="mi">1</span><span class="p">:</span><span class="mi">1</span><span class="p">)</span>       <span class="c">!INSERT INSERT MODE TERMINATOR</span>
         <span class="k">endif</span>
<span class="k">         do </span><span class="n">j</span><span class="o">=</span><span class="n">ic</span><span class="p">,</span><span class="n">i</span>                       <span class="c">!LOOP OF NUMBER OF CHARS INSERTED</span>
            <span class="n">ichr</span><span class="o">=</span><span class="n">ichr</span><span class="o">+</span><span class="mi">1</span>                  <span class="c">!INCREMENT COUNTER FOR NEW LINE</span>
            <span class="k">if</span><span class="p">(</span><span class="n">ichr</span><span class="p">.</span><span class="n">gt</span><span class="p">.</span><span class="n">lmax</span><span class="p">)</span><span class="k">goto </span><span class="mi">999</span>     <span class="c">!IF AT BUFFER LIMIT, QUIT</span>
            <span class="n">dum2</span><span class="p">(</span><span class="n">ichr</span><span class="p">:</span><span class="n">ichr</span><span class="p">)</span><span class="o">=</span><span class="n">cline</span><span class="p">(</span><span class="n">j</span><span class="p">:</span><span class="n">j</span><span class="p">)</span>   <span class="c">!APPEND CHARS FROM ORIG LINE</span>
         <span class="k">enddo</span>                           <span class="c">!...WHICH ALIGN WITH INSERTED CHARS</span>
         <span class="n">ic</span><span class="o">=</span><span class="n">i</span>                            <span class="c">!RESET CHAR COUNT TO END OF INSERT</span>
         <span class="k">goto </span><span class="mi">1</span>                          <span class="c">!CHECK NEW LINE LENGTH AND CYCLE</span>
      <span class="k">endif</span>                              <span class="c">!END OF TERMINATED INSERT LOGIC</span>
      <span class="n">ichr</span><span class="o">=</span><span class="n">ichr</span><span class="o">+</span><span class="mi">1</span>                        <span class="c">!INCREMENT NEW LINE COUNT</span>
      <span class="n">dum2</span><span class="p">(</span><span class="n">ichr</span><span class="p">:</span><span class="n">ichr</span><span class="p">)</span><span class="o">=</span><span class="n">cmod</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">)</span>          <span class="c">!SET NEWLINE CHAR TO INSERTED CHAR</span>
   <span class="k">else</span>                                  <span class="c">!IF NOT INSERTING CHARACTERS</span>
      <span class="n">ic</span><span class="o">=</span><span class="n">ic</span><span class="o">+</span><span class="mi">1</span>                            <span class="c">!INCREMENT ORIGINAL LINE COUNTER</span>
      <span class="k">if</span><span class="p">(</span><span class="n">cmod</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">).</span><span class="n">eq</span><span class="p">.</span><span class="n">c</span><span class="p">(</span><span class="mi">1</span><span class="p">:</span><span class="mi">1</span><span class="p">))</span><span class="k">goto </span><span class="mi">1</span>      <span class="c">!IF DELETE CHAR. NO COPY AND CYCLE</span>
      <span class="k">if</span><span class="p">(</span><span class="n">cmod</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">).</span><span class="n">eq</span><span class="p">.</span><span class="n">c</span><span class="p">(</span><span class="mi">3</span><span class="p">:</span><span class="mi">3</span><span class="p">))</span><span class="k">then</span>        <span class="c">!IF BEGIN INSERT MODE</span>
         <span class="n">linsrt</span><span class="o">=</span><span class="p">.</span><span class="n">true</span><span class="p">.</span>                   <span class="c">!SET INSERT FLAG TRUE</span>
         <span class="k">goto </span><span class="mi">1</span>                          <span class="c">!CHECK LINE LENGTH AND CONTINUE</span>
      <span class="k">endif</span>                              <span class="c">!IF NOT BEGINNING INSERT MODE</span>
      <span class="n">ichr</span><span class="o">=</span><span class="n">ichr</span><span class="o">+</span><span class="mi">1</span>                        <span class="c">!INCREMENT NEW LINE COUNTER</span>
      <span class="k">if</span><span class="p">(</span><span class="n">cmod</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">).</span><span class="n">eq</span><span class="p">.</span><span class="n">c</span><span class="p">(</span><span class="mi">2</span><span class="p">:</span><span class="mi">2</span><span class="p">))</span><span class="k">then</span>        <span class="c">!IF REPLACE WITH BLANK</span>
         <span class="n">dum2</span><span class="p">(</span><span class="n">ichr</span><span class="p">:</span><span class="n">ichr</span><span class="p">)</span><span class="o">=</span><span class="s1">&#39; &#39;</span>             <span class="c">!SET NEWLINE CHAR TO BLANK</span>
         <span class="k">goto </span><span class="mi">1</span>                          <span class="c">!CHECK LINE LENGTH AND CYCLE</span>
      <span class="k">endif</span>                              <span class="c">!IF NOT REPLACE WITH BLANK</span>
      <span class="k">if</span><span class="p">(</span><span class="n">cmod</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">).</span><span class="n">eq</span><span class="p">.</span><span class="s1">&#39; &#39;</span><span class="p">)</span><span class="k">then</span>           <span class="c">!IF BLANK, KEEP ORIGINAL CHARACTER</span>
         <span class="n">dum2</span><span class="p">(</span><span class="n">ichr</span><span class="p">:</span><span class="n">ichr</span><span class="p">)</span><span class="o">=</span><span class="n">cline</span><span class="p">(</span><span class="n">ic</span><span class="p">:</span><span class="n">ic</span><span class="p">)</span>    <span class="c">!SET NEW CHAR TO ORIGINAL CHAR</span>
      <span class="k">else</span>                               <span class="c">!IF NOT KEEPING OLD CHAR</span>
         <span class="n">dum2</span><span class="p">(</span><span class="n">ichr</span><span class="p">:</span><span class="n">ichr</span><span class="p">)</span><span class="o">=</span><span class="n">cmod</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">)</span>       <span class="c">!REPLACE ORIGINAL CHAR WITH NEW</span>
      <span class="k">endif</span>                              <span class="c">!END CHAR KEEP OR REPLACE</span>
   <span class="k">endif</span>                                 <span class="c">!END INSERT OR NO-INSERT</span>
<span class="mi">1</span>  <span class="k">continue</span>
<span class="k">   if</span><span class="p">(</span><span class="n">i</span><span class="p">.</span><span class="n">lt</span><span class="p">.</span><span class="n">lmax</span><span class="p">)</span><span class="k">goto </span><span class="mi">11</span>                  <span class="c">!CHECK FOR END OF LINE REACHED</span>
                                         <span class="c">!AND CYCLE IF OK</span>
<span class="mi">999</span>   <span class="k">continue</span>
<span class="k">   </span><span class="n">cline</span><span class="o">=</span><span class="n">dum2</span>                            <span class="c">!SET ORIGINAL CHARS TO NEW CHARS</span>
<span class="k">end subroutine </span><span class="n">modif</span>                     <span class="c">!RETURN</span>
</pre></div>

    </section>
    <br>
    
    
    </div>
  </div>


    <hr>    
    </div> <!-- /container -->
    <footer>
      <div class="container">
      <div class="row">
        <div class="col-xs-6 col-md-4"><p>&copy; 2022 
                                          </p></div>
        <div class="col-xs-6 col-md-4 col-md-push-4">
          <p class="text-right">
            Documentation generated by 
            <a href="https://github.com/cmacmackin/ford">FORD</a>
             on 2022-01-16 22:32  
          </p>
        </div>
        <div class="col-xs-12 col-md-4 col-md-pull-4"><p class="text-center"> M_strings was developed by John S. Urban</p></div>
      </div>
      <br>
      </div> <!-- /container -->    
    </footer>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
<!--
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
-->
    <script src="../js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../js/ie10-viewport-bug-workaround.js"></script>

    <!-- MathJax JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'AMS' } },
        jax: ['input/TeX','input/MathML','output/HTML-CSS'],
        extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']
      });
    </script>
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    
    
    <script src="../tipuesearch/tipuesearch_content.js"></script>
    <script src="../tipuesearch/tipuesearch_set.js"></script>
    <script src="../tipuesearch/tipuesearch.js"></script>
    
    
  </body>
</html>